<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class App extends MX_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->library('users/auth');
		$this->load->library('form_validation');
		$this->lang->load('user');
		
		$this->load->model('users/user_roles_m');
		$this->load->model('users/users_m');
		
		// TODO: Temporary Code
		$this->load->model('student/student_m', 'student');
		
		$this->template
				->set_breadcrumb('Home','dashboard')
		   		->set_partial('header', 'partials/header')
				->set_partial('breadcrumb','partials/breadcrumb')
                ->set_partial('footer', 'partials/footer')
				->set_partial('navigation','partials/admin/menu')
                ->set_layout('default')
				->set_theme('default')
				->append_metadata($this->asset->css('reset.css'))
				->append_metadata($this->asset->css('general.css'))
				->append_metadata($this->asset->css('admin/default.css'))
				->append_metadata($this->asset->css('admin/app.css'))
				->append_metadata($this->asset->css('notifcation.slider.css'))
				->append_metadata($this->asset->css('admin/jquery.accordion.css'))
				->append_metadata($this->asset->js('jquery/jquery-1.6.2.min.js'))
				->append_metadata($this->asset->js('jquery.freeow.js'))
				->append_metadata($this->asset->js('notificationBox.jquery.js'))
				->append_metadata($this->asset->js('jquery_accordion_init.js'));
    }
	
	public function index()
	{	
		$r = new user_roles_m();
		$r->where('user_id', $this->session->userdata('id'))->get();
		
		if ($r->result_count() > 0)
		{
			$user_roles = array();
			foreach ($r AS $role)
			{
				array_push($user_roles, $role->role_id);
			}
		}
		
		$user_data = array('roles' => $user_roles);
			
		$this->session->set_userdata($user_data);
		
		$this->template
				->set_breadcrumb('Dashboard', 'admin/dashboard')
				->build('myroles');
	}
}

/* End of file app.php */
/* Location: ./application/modules/users/controllers/app.php */